package com.ghq.mapper;

import com.ghq.pojo.Drugs;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Mapper
public interface  DrugsMapper {

    @Select("select * from drugstore.drugs")
    List<Drugs> selectAllDrugs();

    @Delete("delete from drugstore.drugs where id = #{id}")
    void deleteDrug(Integer id);

    @Select("select * from drugstore.drugs where id = #{id}")
    Drugs getDrugById(Integer id);

    @Insert("insert into drugstore.drugs(name,specification,price,category,manufacturer) values(#{name},#{specification},#{price},#{category},#{manufacturer})")
    void insertDrug(Drugs drugs);

    void updateDrug(Drugs drugs);

    List<Drugs> getDrugByNameAndCategory(@Param("name") String name, @Param("category") String category);

    void deleteDrugs(List<Integer> ids);
}
